#ifndef BOOK_H
#define BOOK_H

#include <QWidget>
#include<QListWidget>
#include<QPushButton>
#include<QHBoxLayout>
#include<QVBoxLayout>
#include"protocol.h"
#include<QTimer>
class Book : public QWidget
{
    Q_OBJECT
public:
    explicit Book(QWidget *parent = nullptr);
    void updateFileList(const PDU *pdu);
    void clearEnterDir();
    QString enterdir();
    void setDownloadStatus(bool status);
    bool getDownloadStatus();
    QString getSaveFilePath();


    qint64 m_iTotal;  //总的文件大小
    qint64 m_iRecved;  //已接收的文件大小
signals:

public slots:
    void createDir();
    void flushFile();
    void delDir();
    void renameFile();
    void enterDir(const QModelIndex &index);
    void returnPre();  //返回上一级目录
    void uploadFile();

    void uploadFileData();
    void delRegFile();  //删除常规文件
    void downloadFile();

    void shareFile();

private:
    QListWidget *m_pBookListW;
    QPushButton *m_pReturnPB;
    QPushButton *m_pCreateDirPB;
    QPushButton *m_pDelDirPB;
    QPushButton *m_pRenamePB;
    QPushButton *m_pFlushFilePB;
    QPushButton *m_pUpLoadPB;
    QPushButton *m_pDownLoadPB;
    QPushButton *m_pDelFilePB;
    QPushButton *m_pShareFilePB;

    QString m_strEnterDir;
    QString m_strUploadFilePath;
    QTimer *m_pTimer;

    QString m_strSaveFilePath;
    bool m_bDownload;

};

#endif // BOOK_H
